//
//  AXFShopOkeyView.m
//  AXFEightGroup
//
//  Created by ya on 12/27/16.
//  Copyright © 2016 ya. All rights reserved.
//

#import "AXFShopOkeyView.h"
#import "AXFShoppingButtonView.h"

@interface AXFShopOkeyView ()

@property (weak, nonatomic) IBOutlet UILabel *totalPriceLabel;


@end

@implementation AXFShopOkeyView

- (void)awakeFromNib {
    [super awakeFromNib];

    [self configurationNotifications];
}

- (IBAction)actionPayClicked:(id)sender {
    UIViewController *vc = [self viewControllerResponder];
    if (vc) {
        Class vcClass = NSClassFromString(@"AXFShopPayViewController");
        [vc.navigationController pushViewController:[vcClass new] animated:YES];
    }
}

#pragma mark - 配置通知


- (void)configurationNotifications {
    NotificationCenterAddObserver(self,
                                  Action_AXFShoppingButtonView_AmountChange ,
                                  @selector(action_AXFShoppingButtonView_AmountChange:));
}

- (void)action_AXFShoppingButtonView_AmountChange:(NSNotification *)notification {
    self.totalPriceLabel.text = [NSString stringWithFormat:@"总计:$%.1f", _ModelMgr.productTotalPrice];
}

- (void)dealloc {
    NotificationRemoveObserver(self);
}



#pragma mark -

- (CGSize)intrinsicContentSize {
    return CGSizeMake(SCREEN_WIDTH, 44.0);
}

@end
